# To change this template, choose Tools | Templates
# and open the template in the editor.

__author__="root"
__date__ ="$Sep 30, 2009 6:35:57 PM$"

import re
import xdrlib

class Grade:

    def __init__(self, quarter, grades):

        self.Quarter = long( quarter )
        self.Grade = 0
        self.Actual = 0
        self.Active = False

        GradeMatch = re.findall(r"(.+?)<br>(.+?)", grades, re.M)
        
        if( GradeMatch ):
            self.Grade = long( GradeMatch[0][0] )
            self.Actual = long( GradeMatch[0][1] )
            self.Active = True

    def WriteToBuffer(self, buff):
        buff.pack_int( self.Quarter)
        buff.pack_int( self.Grade )
        

    def __str__(self):
        return '[%s, %s]' % (self.Grade, self.Quarter)
         



